package com.ellricky.baselib.ui.xufei;

import com.andr.common.http.callback.BaseCallback;
import com.andr.common.ui.adapter.BaseRecyclerAdapter;
import com.andr.common.ui.mvp.BasePresenter;
import com.andr.common.widget.refresh.RefreshFlag;
import com.ellricky.baselib.BaseConstant;
import com.ellricky.baselib.R;
import com.ellricky.baselib.adapter.xufei.PzAdapter;
import com.ellricky.baselib.entity.xufei.PayFileEntity;
import com.ellricky.baselib.http.callback.EListCallback;
import com.ellricky.baselib.ui.base.BaseRefreshActivity;

import java.util.List;

import static com.ellricky.baselib.http.Api.PZ_DETAIL;

/**
 * 凭证详情
 */
public class PayDetailActivity extends BaseRefreshActivity<Void, BasePresenter<Void>, PayFileEntity> {
    private String id;


    @Override
    public void initUIView() {
        id = getIntent().getStringExtra(BaseConstant.KEY_ID);
        super.initUIView();
        mTvTitle.setText(R.string.base_stu_price_detail);
    }

    @Override
    protected void setRefreshListener() {
        rvView.init(this, RefreshFlag.NONE);
    }

    @Override
    protected BaseCallback getResponseCallback() {
        return new EListCallback<PayFileEntity>(this) {
            @Override
            protected void onSuccess(List<PayFileEntity> data, String msg) {
                dataSource = data;
                adapter.refresh(dataSource);
            }
        };
    }

    @Override
    protected BaseRecyclerAdapter<PayFileEntity> getRvAdapter() {
        return new PzAdapter(this);
    }

    @Override
    protected String getUrlPath() {
        return PZ_DETAIL;
    }

    @Override
    protected void initParamMap() {
        paramMap.put("id",id);
    }
}
